#include <stdio.h>

double polynom(double x,double a[], int n)
{
	double result=0;
	int i;
	for ( i=0 ; i<=n ; ++i )
	{
		int b;
		double temp=1;
		for ( b=0 ; b<i ; ++b )
		{
			temp=temp*x;
		} 
		result=result+temp*a[i];
	}
	return result;
}

void main()
{
	int n,i;
	double x;
	double a[55];
	printf("Ender x\n");
	scanf("%lf",&x);
	printf("Ender n\n");
	scanf("%d",&n);
	printf("Enter %d numbers a[1],a[2]... \n",n);
	for ( i=0 ; i<=n ; ++i )
	{
		printf("you entered %d numbers, %d remaining\n",i,n-i);
		scanf("%lf",&a[i]);
	}
	printf("the result is: %lf\n",polynom(x,a,n));
	
	system("PAUSE");

}